<?php
class FlinkModel extends Model {
	//自动验证文章内容
	protected $_validate=array(
		array('title','require','{%fl_form_validata_title_required}'),
		array('url','require','{%fl_form_ele_url_tip}'),
	);
	
	//自动填充内容  addtime
	protected $_auto   =   array(
		array('addtime','time',1,'function'),//add添加的时候自动填充
		//array('solevar','create_id',1,'function'),
	);
	
	//得到对应语言包，对应模块的全局分类
	public function getCateSelect($module,$lang,$nid=0){
	
		$cates   = $this->getCateByModule($module,$lang);
		$row     = $this->getCateRoot($module,$lang);
		$selects = get_cate_select($cates,$row['pid'],$nid);
		return $selects;
		
	}
	
	public function getCateByModule($module,$lang) {
		$cates = S('cate_'.$lang.$module);
		if(empty($cates)){
			$where = "module='".$module."' and lang='".$lang."'";
			$cates = $this->where($where)->select();
			S('cate_'.$lang.$module,$cates);
		}
		return $cates;
	}
	
	public function getCateRoot($module,$lang) {
		$where = "module='".$module."' and lang='".$lang."' and pid =0";
		return $this->where($where)->find();
	}
	
}
?>